package com.fengmi.listener;

import com.fengmi.entity.goods.MallGoods;
import com.fengmi.service.ISearchService;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(consumerGroup = "goods-consumer"
        ,topic = "goods-produce",selectorExpression = "goods-tags"
        ,consumeMode = ConsumeMode.CONCURRENTLY,messageModel = MessageModel.CLUSTERING)
public class GoodsListener implements RocketMQListener<MallGoods> {
    @Autowired
    private ISearchService searchService;
    @Override
    public void onMessage(MallGoods mallGoods) {
        //同步索引库
        searchService.goodsToBu(mallGoods);
    }
}
